<header class="layout head padding-small">
    <a href="javascript:pageBack();" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white">APP 下载</h4>
    <a href="javascript:;" id="btnJdkey" class="hHlep float-right"></a>
</header>
<div>
    <img id="app_download" style="width:100%;max-width:640px;" src="<?php echo TEMPLATES_PATH?>/images/appimg.jpg" alt="app下载" usemap="#appMap" />
    <map id="appMap" name="appMap">
        <area shape="rect" coords="394,172,524,206" href="https://itunes.apple.com/cn/app/id998160037" title="App Store下载" alt="App Store下载" />
        <area shape="rect" coords="394,226,524,260" href="http://dd.myapp.com/16891/56ADBEC6AC00094B596175D74D0D3686.apk?fsname=com.d1mcw.xincaichao_1.0.9_91.apk&asr=02f1" alt="Android下载" title="Android下载" />
    </map>
</div>
<script>
    //当用户屏幕转屏时，发生一个页面刷新,这样保持图像热区位置正确性
    window.onorientationchange=window.onresize=function() {
        window.location.reload();
    }

    //当图片发生缩放时，热区位置就会错位，要根据图像变化时时调整坐标位置
    var orig_width = 640; //原始宽度
    var next_width =$('#app_download').width();//不同屏下的初始宽度

    var bili = next_width/orig_width;
   if(bili < 1){
       //app store的coords缩小
       var app_sx = 394*bili,app_sy = 172*bili,app_ex = 524*bili,app_ey=206*bili;
       var app_coords_new = app_sx+','+app_sy+','+app_ex+','+app_ey;
       $('area[title="App Store下载"]').attr('coords',app_coords_new);
       //android 的coords缩小
       var andr_sx = 394*bili,andr_sy = 226*bili,andr_ex = 524*bili,andr_ey=260*bili;
       var andr_coords_new = andr_sx+','+andr_sy+','+ andr_ex+','+andr_ey;
       $('area[title="Android下载"]').attr('coords',andr_coords_new);
   }
</script>


